import networkService from "./interceptor";
import { AxiosRequestConfig } from "axios";

export function get(url: string, config?: AxiosRequestConfig): Promise<any> {
  return networkService.get(url, {
    ...config,
  });
}

export function post(
  url: string,
  params: unknown,
  config?: AxiosRequestConfig
): Promise<any> {
  return networkService.post(url, params, {
    // headers: {
    //   "Content-Type": "application/json;charset=utf-8",
    // },
    ...config,
  });
}

export function form(
  url: string,
  params: unknown,
  config?: AxiosRequestConfig
): Promise<any> {
  return networkService.post(url, params, {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
    },
    ...config,
  });
}
